package com.es.test.utils;

import java.util.*;
import java.util.stream.Collectors;

/**
 * @author django
 * @date 2024/1/31
 * @description
 */
public class LabelBuilder {
    private static String labelString = "openstatus,createdate,from_domain_resume,add_type,resume_update_date,c_project_exp_star,c_cert_star,resume_refresh_date,resume_key_word,top_func_type,top_industry,base_update_date,edu_update_date,work_update_date,resume_self_update_date,c_base_star,c_work_exp_star,c_edu_exp_star,c_desire_star,birthday,workyear,area,current_situation,sex,mb_num_status,email_status,last_login_date,from_domain_user,last_login_ip,create_ip,user_update_time,verify_date,personas,is_lock,from_bu,delete_51job,delete_yjs,delete_jy,delete_mdd,privacy_close,createdate_user,expect_func_one,expect_area_one,expect_industry_one,expect_salary_one,expect_func_two,expect_area_two,expect_industry_two,expect_salary_two,expect_func_three,expect_area_three,expect_industry_three,expect_salary_three,is_del_user_info,timefrom_work_exp_last,timeto_work_exp_last,company_type_last,company_size_last,work_func_last,work_industry_last,work_type_last,is_oversea_last,c_comp_name_last,timefrom_work_exp_second_last,timeto_work_exp_second_last,company_type_second_last,company_size_second_last,work_func_second_last,work_industry_second_last,work_type_second_last,is_oversea_second_last,c_comp_name_second_last,timefrom_edu_exp_last,timeto_edu_exp_last,degree_last,major_last,c_school_name_last,is_oversea_edu_last,language_class,certs,best_resume_num,is_fulltime,is_upload_resume,is_degree_authentication,degree_intention,upload_resume_id,upload_resume_create_date,redister_department,redister_cooperator,redister_deeplinkid,redister_partner,last_login_department,last_login_cooperator,last_login_deeplinkid,last_login_partner,last_second_last_login_date,last_login_domain,last_login_app_date,job51_app_tag,first_post_domain,first_post_date,is_new_uuid,hr_read_date,hr_load_date,last_search_date,last_open_date,last_post_job_date,last_chat_date,last_job_func,last_online_apply_fail_date,last_online_apply_succes_date,is_buy_vas,is_buy_edu,b_last30dayseduduration,b_last30daysedutrialduration,b_last30daysedupcduration,b_last30dayseduh5duration,b_last30dayseduappduration,b_last30dayseduyjsduration,b_lasteduvisittime,b_last30daysclewsigncount,b_lastclewsigntime,b_edutotalbuyorder,b_lastedubuytime,b_juniorcollege,b_fullexpectworkfunc,b_usertype,b_activeperiod,b_jobintention,b_lastactivetime,b_lastappactivetime,b_lastpcactivetime,b_lastmactivetime,b_lastsearchtime,b_lastviewtime,b_last7dayssearchcount,b_last7dayssearchdays,b_last7daysviewcount,b_last7daysviewdays,b_last7daysactivedays,b_last15dayssearchcount,b_last15dayssearchdays,b_last15daysviewcount,b_last15daysviewdays,b_last15daysactivedays,b_last30dayssearchcount,b_last30dayssearchdays,b_last30daysviewcount,b_last30daysviewdays,b_last30daysactivedays,b_applyintention,b_applyhabit,b_lastapplytime,b_last7daysapplycount,b_last7daysapplydays,b_last15daysapplycount,b_last15daysapplydays,b_last30daysapplycount,b_last30daysapplydays,b_chatintention,b_chatperiod,b_chathabit,b_last7dayschatreplycount,b_last7daysactivechatcount,b_last7dayspassivechatcount,b_last7daysgetreplycount,b_last7daysreplycount,b_lastchattime,b_answerphoneperiod,b_last7daysanswerphonecount,b_last7daysringcount,b_last7dayslostcallcount,b_lastanswerphonetime,b_viewcompetitiveness,b_downloadcompetitiveness,b_chatcompetitiveness,b_phonecallcompetitiveness,b_inboxcompetitiveness,b_rsmcompetitiveness,b_workareapreference,b_workfuncpreference,b_industrypreference,b_expectsalarypreference,b_iphonepreference,b_androidpreference,b_pcpreference,b_mpreference,b_minipreference,b_wxoffaccpreference,b_chatpreference,b_phoneanswerpreference,b_searchpreference,b_tabrecpreference,b_tabnearpreference,b_tabnewpreference,b_baseinfointegrity,b_intentionintegrity,b_eduexpintegrity,b_workexpintegrity,b_isgreyrsm,b_isblackrsm,b_recentworktime,b_avgworktime,b_manageworktime,b_workexpcount,b_userterm,b_bachelorschooltype,b_topschoolhierarchy,b_hierarchyschoolname,expect_seek_type_one,expect_seek_type_two,expect_seek_type_three,from_domain_user_new,from_domain_resume_new,partner_enterprise_wechat,first_bind_enterprise_wechat,last_update_enterprise_wechat,c_work_exp_star_new_rule,c_edu_exp_star_new_rule,user_redister_partner,yjs_create_time,yjs_degree,yjs_major,yjs_school_name,yjs_edu_time_from,yjs_edu_time_to,yjs_review_status,last_hr_opt_date,last_hr_create_chat_date,last_hr_initiate_chat_date,last_hr_reply_chat_date,wechat_bind_status,push_success_rate,push_arrive_rate,push_click_rate,push_login_rate,push_post_rate,map4_report_id,map4_open_status,map4_report_time,last_job_collect_date,last_push_click_date,send_num,open_num,click_num,open_login_num,open_click_date,candidateurgentscore,candidateurgent,candidatepopularscore,candidatepopular,ismba,b_topschoolname,wechat_id,cselfintro,eselfintro,resumekey,expect_minsalary_one,expect_minsalary_two,expect_minsalary_three,expect_maxsalary_one,expect_maxsalary_two,expect_maxsalary_three,projet_cdescribe,projet_ccompname,projet_cname,projet_starttime,projet_endtime,bonus_cname,bonus_time,prac_cname,prac_starttime,prac_endtime,certname,getdate,ability,cworkdescribe_last,cworkdescribe_second_last,work_skill_last,work_skill_second_last,isoverseas,cdescribe,work_cposition_last,work_cposition_second_last,user_preference,app_phone_manufacturer,c_name";
    public static List<String> labelList = Arrays.stream(labelString.split(",")).collect(Collectors.toList());
    public static Map<String, String> randomMap(List<String> dataList, int num) {
        Map<String, String> dataMap = new HashMap<>();
        Random random = new Random();
        // 生成10以内的随机整数
        int randomNumber = random.nextInt(num);
        List<String> randomElements = getRandomElements(dataList, randomNumber);
        randomElements.forEach(item -> dataMap.put(item,  String.valueOf(new Random().nextInt(4))));
        return dataMap;
    }
    // 获取随机元素的方法
    public static <T> List<T> getRandomElements(List<T> originalList, int count) {
        // 创建一个 Random 对象
        Random random = new Random();
        // 创建一个副本，以免修改原始列表
        List<T> copyList = new ArrayList<>(originalList);

        // 打乱副本列表
        Collections.shuffle(copyList, random);

        // 获取随机元素的子列表
        return copyList.subList(0, Math.min(count, copyList.size()));
    }


}
